
function GM:PlayerSpawn( ply )

	ply:CrosshairDisable();
	
	if( ply:GetPlayerRagdolled() ) then
		
		ply:MakeNotInvisible();
		ply:Freeze( false );
		ply:CrosshairDisable();
		
		ply:SetPlayerRagdolled( false );

		ply:RemoveRagdoll();
	
	end
	
	ply:Give( "gmod_tool" );	
	ply:Give( "weapon_physgun" );	
	
	ply:SetPlayerLastHeldWeapon( "" );

	ply:SetPlayerRArmHP( 100 );
	ply:SetPlayerLArmHP( 100 );
	ply:SetPlayerRLegHP( 100 );
	ply:SetPlayerLLegHP( 100 );
	ply:SetPlayerSprint( 100 );
	ply:SetPlayerConscious( 100 );
	ply:SetPlayerBlood( 100 );
	ply:SetPlayerBleedingAmount( 0 );
	
	ply:SetTeamModel();
	ply:GiveTeamLoadout();
	
	ply:DoModelSpecificData();
	
	if( ply:GetTable().HeavyWeapon ) then
		ply:Give( ply:GetTable().HeavyWeapon.Data.ID );
	end

	if( ply:GetTable().LightWeapon ) then
		ply:Give( ply:GetTable().LightWeapon.Data.ID );
	end	
	
	ply:SelectWeapon( "ep_hands" );

end

function GM:DoPlayerDeath( ply, attacker, dmginfo )

	if( not ply:GetTable().IsRagdolled ) then
	
		ply:CreateRagdoll();
	
	end

end

function GM:CanPlayerSuicide( ply )

	if( ply:GetTable().IsRagdolled ) then
	
		return false;
	
	end
	
	if( not ply:GetTable().CanSeePlayerMenu ) then
	
		return false;
	
	end
	
	if( ply:GetTable().Invisible ) then
	
		return false;
	
	end
	
	return true;

end

function GM:PlayerDeath( ply, inflictor, killer )

	for k, v in pairs( ply:GetTable().ProgressBars ) do
	
		ply:RemoveProgressBar( k );
	
	end

	if( ply:GetPlayerRagdolled() ) then
	
		ply:Freeze( false );
	
	end

	if( ply:GetTable().BledToDeath ) then
	
		umsg.Start( "D", ply );
			umsg.Short( 4 );
		umsg.End();
			
	else

		if( ply == killer ) then
			
			if( ply:GetTable().HitByMelee ) then
					
				umsg.Start( "D", ply );
					umsg.Short( 6 );
				umsg.End();	
				
				ply:GetTable().HitByMelee = false;
				
			else
				
				umsg.Start( "D", ply );
					umsg.Short( 1 );
				umsg.End();
				
			end
		
		end
		
		if( ply ~= killer ) then
		
			if( killer:GetClass() == "common" ) then
			
				umsg.Start( "D", ply );
					umsg.Short( 5 );
				umsg.End();		
				
			elseif( ply:GetTable().HeadShot ) then
		
				umsg.Start( "D", ply );
					umsg.Short( 3 );
				umsg.End();		
				
				ply:GetTable().HeadShot = false;
				
			else
	
				umsg.Start( "D", ply );
					umsg.Short( 2 );
				umsg.End();
			
			end
		
		end

	end

end

function GM:KeyPress( ply, key )

	if( key == IN_SPEED and key == IN_WALK ) then
	
		
	
	end

end

function GM:PlayerDeathSound()

	return true;

end